#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  mnyield.py
#       Author @  Huoty
#  Create date @  2015-10-26 09:25:26
#  Description @  
# *************************************************************



# Script starts from here

def flatten(nested):
    result = []
    try:
        # 不要迭代类似字符串的对象
        try: nested + ""
        except TypeError: pass
        else: raise TypeError
        for sublist in nested:
            for element in flatten(sublist):
                result.append(element)
    except TypeError:
        result.append(nested)
    return result
